<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">

<xi:include href="master.html" />

<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
    <title>Yale Club Beijing</title>
    <script type="text/javascript">
    //<![CDATA[
    var sitemap = ${str(sitemap)};
    window.addEvent('domready', function(){
    	$('sitemap').appendChild(getSiteMap(sitemap, 0));
    });
    function isleaf(s){
    	if (!s) return true;
    	if (!s.children) return true;
    	return false;
    }
    function getSiteMap(s, level){
    	if (!s) return null;
    	var ret = document.createElement('li');
    	ret.style.marginLeft = '' + level * 15 + 'px';
		var a = document.createElement('a');
		a.setAttribute('href', s.link);
		a.innerHTML = s.title;
		ret.appendChild(a);
		if (!isleaf(s)){
			var ul = document.createElement('ul');
			for (var i=0; i<s.children.length; i++){
				ul.appendChild(getSiteMap(s.children[i], level+1));
			}
			ret.appendChild(ul);
		}
    	return ret;
    }
    //]]>
    </script>
    <style>
    #sitemap{
    	margin-left: 15px;
    }
    </style>
</head>
<body>
<ul id="sitemap"></ul>
</body>
</html>
